#include<bits/stdc++.h>
using namespace std;
typedef double db;
const int MAXN=225;
int n,r,d[MAXN];
db p[MAXN],f[MAXN][MAXN],muti[MAXN][MAXN],ans;
int main()
{
	int T;
	scanf("%d",&T);
	while(T--)
	{
		memset(f,0,sizeof(f));
		memset(muti,0,sizeof(muti));
		ans=0;
		scanf("%d%d",&n,&r);
		for(int i=1;i<=n;++i)
			scanf("%lf%d",&p[i],&d[i]);
		for(int i=0;i<=r;++i)muti[0][i]=1;
		for(int i=1;i<=n;++i)
		{
			muti[i][0]=1;
			for(int j=1;j<=r+1;++j)
				muti[i][j]=muti[i][j-1]*(1.0-p[i]);
		}
		f[0][r]=1;
		for(int i=1;i<=n;++i)
		{
			for(int j=0;j<=r;++j)
			{
				f[i][j]=(1.0-muti[i][j+1])*f[i-1][j+1];
				ans+=f[i][j]*d[i];
				f[i][j]+=muti[i][j]*f[i-1][j];
			}
		}
		printf("%.10lf\n",ans);
	}
	return 0;
}
